home *** CD-ROM | disk | FTP | other *** search
- Path: EU.net!sun4nl!xs4all!falstaff
- From: falstaff@xs4all.nl (Falstaff)
- Newsgroups: comp.lang.c
- Subject: Re: Bizarre error with structures, please help!
- Date: 16 Mar 1996 13:02:09 GMT
- Organization: XS4ALL, networking for the masses
- Message-ID: <4iee4h$a7u@news.xs4all.nl>
- References: <4idkfo$1el@news.voicenet.com>
- NNTP-Posting-Host: xs1.xs4all.nl
- X-Newsreader: NN version 6.5.0 #666 (NOV)
-
- deaton@cygnus.rsabbs.com writes:
-
-
- >typedef struct
- >{
- > char type[20]; //Weapon name.
- > int cost; //Cost of weapon in Gold.
- > int damhi; //High range of damage for the weapon.
- > int damlo; //Low range of damage for the weapon.
- > int wtype; //Numerical weapon reference.
- > int missle; //Is the weapon a missle weapon? (1 or 0)
- > char size; //'S'mall or 'L'arge. No shield with large.
- > int actual; //Actual damage done directly to a unit.
- > int special; //Special case damage. If 1, actual damage ammount is dealt
- > //to the armor, and remainder is done to the unit.
- >}weaponS;
-
- >static weaponS w[WEP_REF];
-
- >main()
- >{//MAIN
-
- > register int count;
- > FILE * fptr;
- > printf("\n\n\n\n\n\n\Populating Structure.");
-
- > strcpy(w[0].type,"Dagger");
- > w[0].cost=0;
- > w[0].size='s';
- > w[0].wtype=0;
- > w[0].damhi=4;
- > w[0].damlo=1;
- > w[0].actual=1;
- > w[0].special=0;
- > w[0].missle=0;
-
- > putch('.');
-
- > strcpy(w[1].type,"Sabre");
- > w[1].cost=0;
- > w[1].size='s';
- > w[1].wtype=1;
- > w[1].damhi=5;
- > w[1].damlo=2;
- > w[1].actual=1;
- > w[1].special=0;
- > w[1].missle=0;
-
-
- Why aren't you using this? BASIC/Pascal background, perhaps?
-
- struct weapons
- {
- char *type; /* Weapon name (CHANGED TO PTR) */
- int cost; /* Cost of weapon in Gold. */
- int damhi; /* High range of damage for the weapon. */
- int damlo; /* Low range of damage for the weapon. */
- int wtype; /* Numerical weapon reference. */
- int missle; /* Is the weapon a missle weapon? (1 or 0) */
- char size; /* 'S'mall or 'L'arge. No shield with large. */
- int actual; /* Actual damage done directly to a unit. */
- int special; /* Special case damage. */
- } weapons[] = /* No need to specify count here */
- {
- { "Dagger",0,'S',0,4,1,1,0,0 },
- { "Sabre", 0,'S',1,5,2,1,0,0 },
- /* etc */
- };
- --
- The famous GIICM now on line: http://www.xs4all.nl/~falstaff/GIICM.html
- ------------------------------------------------------------------------
- Frank A. Vorstenbosch +31-(70)-355 5241 falstaff@xs4all.nl
-